package com.sc.smartcommunity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.smartcommunity.domain.PaymentRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * @author Chenke Zhao
 * @date 2025/9/10 20:53
 * @description PaymentRecordMapper
 */
@Mapper
public interface PaymentRecordMapper extends BaseMapper<PaymentRecord> {

    @Select("SELECT COALESCE(SUM(amount), 0) FROM payment_record WHERE status = #{status}")
    BigDecimal selectTotalAmountByStatus(@Param("status") Integer status);

}
